<?php if (!defined('THINK_PATH')) exit();?><!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>工单管理-工单历史</title>
    <!-- jquery - boot -库文件 -->
    <script src="/Public/script/jquery.1.11.1.js"></script>
    <script src="/Public/script/bootstrap.min.js"></script>
    <!-- Bootstrap -->
    <link href="/Public/css/bootstrap.min.css" rel="stylesheet">
    <!-- Bootstrap -->
    <!-- font awesome -->
    <link rel="stylesheet" type="text/css" href="/Public/plugins/FontAwesome/css/font-awesome.min.css">
    <script src="/Public/script/common.js"></script>
    <!--easyui包含文件-->
    <link rel="stylesheet" type="text/css" href="/Public/plugins/easyui1.5.3/themes/material/easyui.css">
    <link rel="stylesheet" type="text/css" href="/Public/plugins/easyui1.5.3/themes/icon.css">
    <script type="text/javascript" src="/Public/plugins/easyui1.5.3/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="/Public/plugins/easyui1.5.3/locale/easyui-lang-zh_CN.js"></script>
    <!--layer-->
    <script type="text/javascript" src="/Public/plugins/layer/layer.js"></script>
    <!-- 自定义 css -->
    <link rel="stylesheet" type="text/css" href="/Public/css/reset.css">
    <link rel="stylesheet" type="text/css" href="/Public/css/common.css">
    <link rel="stylesheet" type="text/css" href="/Public/css/style.css">
    <!-- end easyui -->
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="/Public/script/html5shiv.js"></script>
    <script src="/Public/script/respond.js"></script>
    <![endif]-->
</head>

<body>
    <!-- header -->
<div class="container-fluid">
	<div class="row header">
		<div class="logo pull-left"><a href="#">汇氏集团企业服务系统</a></div>
		<div class="navs pull-right">
			<ul>
				<li><i class="fa fa-user-circle"></i><?php echo ($user); ?></li>
				<!-- <li><i class="fa fa-question-circle"></i> 帮助</li> -->
				<a href="<?php echo U('loginout');?>"><li><i class="fa fa-power-off"></i> 退出</li></a>
				<a href="javascript:void(0)" onclick="uppwd()"><li><i class="fa fa-unlock"></i> 修改密码</li></a>
			</ul>
		</div>
	</div>
</div>
<!-- end header -->
<!-- mnavs -->
<nav class="navbar navbar-default">
	<div class="container-fluid">
		<!-- Collect the nav links, forms, and other content for toggling -->
		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
			<ul class="nav navbar-nav">
				<li><a href="index.html">
						  <i class="fa fa-home"></i>&nbsp;首页</a></li>
			   
				<li class="dropdown">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-pencil-square"></i>&nbsp;工商管理</a>
					<ul class="dropdown-menu">
						<li><a href="<?php echo U('fqgd');?>">发起工单</a></li>
						<li><a href="<?php echo U('gdls');?>">工单历史</a></li>
					</ul>
				</li>				
				<li class="dropdown">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-pencil-square-o"></i>&nbsp;库存管理</a>
					<ul class="dropdown-menu">
						<li><a href="<?php echo U('ckcx');?>">仓库查询</a></li>
					</ul>
				</li>				
				<li class="dropdown">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-calendar-check-o"></i>&nbsp;企业管理</a>
					<ul class="dropdown-menu">
						<li><a href="<?php echo U('qygl');?>">企业管理</a></li>
					</ul>
				</li>
				<li class="dropdown">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-refresh"></i>&nbsp;实时视频</a>
					<ul class="dropdown-menu">
						<li><a href="<?php echo U('spjk');?>">视频监控</a></li>
					</ul>
				</li>
				<li class="dropdown">
					<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-flask"></i>&nbsp;统计分析</a>
					<ul class="dropdown-menu">
						<li><a href="<?php echo U('tjfx');?>">统计分析</a></li>
					</ul>
				</li>
                <li class="dropdown">
                    <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><i class="fa fa-flask"></i>&nbsp;系统管理</a>
                    <ul class="dropdown-menu">
                        <li><a href="<?php echo U('yhgl1');?>">用户管理</a></li>
                        <li><a href="<?php echo U('sjzd');?>">数据字典</a></li>
                        <li><a href="<?php echo U('jsgl');?>">角色管理</a></li>
                    </ul>
                </li>
				<li class="dropdown">
					<a href="<?php echo U('appload');?>"  target="_blank"><i class="fa fa-download"></i>&nbsp;APP下载</a>
				</li>				
			</ul>
		</div>
		<!-- /.navbar-collapse -->
	</div>
	<!-- /.container-fluid -->
</nav>
<!-- end mnavs -->
<!-- modals -->
<div id="m" class="easyui-window" title="密码修改" data-options="modal:true,closed:true" style="width:380px;height:300px;padding:15px;display:none;">
		<div class="row">
			<div class="col-md-12">
				<div class="row">
					<div class="col-md-12">
						<input class="easyui-textbox" id="o_pwd" name="o_pwd" type="password" style="width:300px" data-options="label:'旧密码',required:true">
					</div>
					<div class="col-md-12" style="margin-top: 20px;">
						<input class="easyui-textbox" id="n_pwd" name="n_pwd" type="password" style="width:300px" data-options="label:'新密码',required:true">
					</div>
				</div>
				<div class="blank10"></div>
				<div class="blank10"></div>
				<div class="btnin">
					<button class="btn btn-info" id="xgmm">提交</button>&nbsp;
					<button class="btn btn-default" id="quxiao">取消</button>
				</div>
			</div>
		</div>
	</div>
	<!-- /.modal-content -->
	<script>
			function uppwd(){
				$('#m').window('open');
			}
			$('#xgmm').click(function(){
				var o_pwd=$('#o_pwd').textbox('getValue');
				var n_pwd=$('#n_pwd').textbox('getValue');
				var option={
					type: "POST",
					url: "<?php echo U('uppwd');?>",
					data: {o_pwd: o_pwd,n_pwd: n_pwd},
					success: function(data) {
						if(data['status']==1){
							window.location.href="<?php echo U('login');?>";
						}
						else{
							alert(data['info']);
						}
					}
				};
				$.ajax(option);
			})
		
			$('#quxiao').click(function(){
				$('#o_pwd').textbox('setValue','');
				$('#n_pwd').textbox('setValue','');
			})
		
			$('#dh .dropdown').hover(function(){
				$(this).find('.dropdown-menu').fadeIn();
			},function(){
				$(this).find('.dropdown-menu').fadeOut();
			})
		</script>
    <!-- indexmain -->
    <div class="container-fluid">
        <div class="row">
            <div class="col-md-12 mainbox" id="mainbox">
                <!--menubegin-->
                <div class="datamenubox" id="leftmenu">
                    <div class="menuhead">工单管理</div>
                    <!-- treein -->
                    <div class="treein" id="menuin">
                        <ul class="list-group smenu">
                            <?php if(is_array($menulist)): $i = 0; $__LIST__ = $menulist;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?><a href="<?php echo U($vo[url]);?>"><li class="list-group-item" id="<?php echo ($vo["url"]); ?>"><i class="fa fa-angle-right"></i><?php echo ($vo["name"]); ?></li></a><?php endforeach; endif; else: echo "" ;endif; ?>
                        </ul>
                    </div>
                </div>
                <!--menuend-->
                <!--mainboxbegin-->
                <div class="col-md-12 rights" id="right">
                    <!-- 位置导航 -->
                    <ol class="breadcrumb">
                        <li class="active">首页</li>
                        <li class="active">工单管理</li>
                        <li class="active">工单历史</li>
                    </ol>
                    <!-- 筛选 -->
                    <div class="searchitem">
                        <div class="row">
                            <div class="col-md-12">
                                <input class="easyui-textbox" name="q_name" id="q_name" style="width:300px" data-options="label:'标题：',required:false">
                                <button class="btn btn-danger" id="querybtn">查询</button>
                            </div>
                        </div>
                        <div class="blank10"></div>
                        <div class="row">
                            <div class="col-md-12">
                                <div class="btnin">
                                    <button class="btn btn-info" id="fqbtn">发起</button>
                                    <button class="btn btn-info" id="updatebtn">编辑</button>
                                    <button class="btn btn-info" id="delbtn">批量删除</button>
                                </div>
                            </div>
                        </div>
                        <!-- end 筛选 -->
                    </div>
                    <!-- listtable -->
                    <div>
                        <!-- gridview row -->
                        <table id="dg"></table>
                        <!-- end gridview row -->
                    </div>
                    <!--mainboxend-->
                </div>
            </div>
        </div>
        <div id="w" class="easyui-window" title="添加/编辑用户" data-options="modal:true,closed:true" style="width:500px;height:400px;padding:15px;display:none;">
            <div class="row">
                <div class="col-md-12">
                    <form id="ff" method="post" data-options="novalidate:true">
                        <div class="row">
                            <div class="col-md-6">
                                <input class="easyui-combobox" name="lx" id="lx" style="width:180px" data-options="label:'类型：',valueField:'id',textField:'text',panelHeight:'100',required:true">
                            </div>
                            <div class="col-md-6">
                                <input class="easyui-combobox"   name="weizhi" id="weizhi" style="width:180px" data-options="label:'位置：',valueField:'id',textField:'text',panelHeight:'100',required:true">
                            </div>
                        </div>
                        <div class="blank10"></div>
                        <div class="row">
                            <div class="col-md-6">
                                <input class="easyui-textbox" name="qy" id="qy" style="width:180px" data-options="label:'服务企业：',valueField:'id',textField:'text',panelHeight:'100',required:true">
                            </div>
                            <div class="col-md-6">
                                <input class="easyui-datebox"  type="text" name="sj" id="sj" style="width:180px" data-options="label:'时间：',required:true">
                            </div>
                        </div>
                        <div class="blank10"></div>
                        <div class="row">
                            <div class="col-md-12">
                                <input class="easyui-textbox" name="xq" id="xq" style="width: 300px;" data-options="label:'详情：',prompt:'不能超过50个字',valueField:'id',textField:'text',panelHeight:'100',required:true"/>
                            </div>
                        </div>
                        <div class="blank10"></div>
                        <div class="row">
                            <div class="col-md-6">
                                <input class="easyui-combobox" name="ry" id="ry" style="width:180px" data-options="label:'人员：',valueField:'id',textField:'text',panelHeight:'100',required:true"/>
                            </div>
                        </div>
                        <input type="hidden" id="hidid" name="hidid" />
                    </form>
                    <div class="blank10"></div>
                    <div class="btnin">
                        <a class="btn btn-info" id="submits">保存</a>&nbsp;
                        <a class="btn btn-default" id="clear">重置</a>
                    </div>
                </div>
            </div>
        </div>
        <div id="h" class="easyui-window" title="<?php echo ($h["xm"]); ?>/<?php echo ($h["xq"]); ?>" data-options="modal:true,closed:true" style="width:600px;height:500px;padding:15px;display:none;">
                        <div class="box-group-item">
                            <p><?php echo ($h["jz"]); ?>  <?php echo ($h["sj"]); ?></p>
                            <p><?php echo ($h["xq"]); ?></p>
                            <div class="box-group-item-right">
                                <?php echo ($h["zp"]); ?>
                            </div>
                        </div>

                </div>

    </div>
    <!-- footer -->
<div class="container-fluid">
    <div class="row">
        <div class="col-md-12 footer">
            汇氏环境 版权所有  copyright ©  2018-2020 技术支持:东博软件&nbsp;<a href="http://www.doposoft.cn" target="_blank">doposoft.cn</a>
        </div>
    </div>
</div>
<!-- end footer -->
    <script>
    $(document).ready(function() {
        //初始化页面
        $('#gdls').addClass('on');
        loaddg();
        LoadDDL('lx','LX');
        LoadDDL('weizhi','WEIZHI');
        LoadDDL('ry','RY');
    });
    //加载数据列表
    function loaddg() {
        $('#dg').datagrid({
            loadMsg: '正在查询，请稍后...',
            height: $(window).height() - 300,
            url: '<?php echo U('querygd');?>',
            queryParams: {
                username: $('#q_name').textbox('getValue')
            },
            nowrap: false,
            striped: true,
            collapsible: false,
            loadMsg: '正在加载，请稍后。。。',
            remoteSort: false,
            singleSelect: false,
            pageSize: 100,
            idField: 'id',
            pagination: true,
            rownumbers: false,
            pagination: true,
            pageNumber: 1,
            pageSize: 20,
            pageList: [20, 40, 80, 160],
            fitColumns: true,
            columns: [
                [{
                    field: 'ck',
                    checkbox:true,
                },{
                    field: 'id',
                    title: '工单号',
                    width: 100
                }, {
                    field: 'lx',
                    title: '类别',
                    width: 100
                }, {
                    field: 'ry',
                    title: '工程师',
                    width: 100
                }, {
                    field: 'qy',
                    title: '服务企业',
                    width: 100
                }, {
                    field: 'sj',
                    title: '发起时间',
                    width: 100
                }, {
                    field: 'cz',
                    title: '操作',
                    width: 100
                }]
            ],
            onDblClickRow:function(index,row){
                $('#h').window('open');
                $('#piclist').html('');
                document.getElementById("hidid").value = row.id;
                loadphoto(row.id);
            }
        });
        $("#querybtn").click(function() {
            $('#dg').datagrid('load', {
                "uname": $('#q_name').textbox('getValue')
            });
        });
    }
    function loadphoto(id){
        var html='';
        var option = {
            type: "POST",
            url: "<?php echo U('queryphoto');?>",
            data: {id:id},
            success: function (data) {
                for(var i=0;i<data.length;i++){
                    html+='<div class="col-md-12" style="margin-top: 3px;">' +
                        '<a href="'+data[i]['img_path']+'" target="_blank"</a>现场照片</div>';
                }
                $('#piclist').html(html);
            }
        };
        $.ajax(option);
    }
    // 发起工单页面
    $("#fqbtn").click(function() {
        $('#ff').form('clear');
        document.getElementById("hidid").value = "I";
        $('#w').window('open');
    })
    //编辑
    $("#updatebtn").click(function() {
        var row = $('#dg').datagrid('getSelected');
        if (row) {
        $('#ff').form('clear');
        document.getElementById("hidid").value = row.id;
        $('#lx').combobox('setValue',row.lx);
        $('#ry').combobox('setValue',row.ry);
        $('#qy').textbox('setValue',row.qy);
        $('#sj').datebox('setValue',row.sj);
        $('#weizhi').combobox('setValue',row.weizhi);
        $('#xq').textbox('setValue',row.xq);
        $('#w').window('open');
        }
        else{
            layer.msg('请选择需要编辑的用户！');
        }
    })

    //重置
    $('#clear').click(function(){
        $('#ff').form('clear');
    })

    //删除
    $('#delbtn').click(function(){
        var row = $('#dg').datagrid('getChecked');
        if(row){
            layer.confirm('您确定要删除选中的数据？', {
                btn: ['是','否'] //按钮
                }, function(){
                    var option = {
                        type: "POST",
                        url: "<?php echo U('delgd');?>",
                        data: {id:row.id},
                        success: function (data) {
                            layer.close();
                            layer.msg(data);
                            $("#querybtn").click();
                        }
                    };
                    $.ajax(option);
                }, function(){
                    layer.closeAll();
                });
            }
        else{
            layer.msg('请选择需要删除的数据！');
        }
    })
    //发起工单
    $('#submits').click(function(){
        var url="";
        var flg = document.getElementById("hidid").value;
        if (flg == "I") {
            url = "<?php echo U('addwork');?>";
        } else {
            url = "<?php echo U('editgd');?>";
        }
        $('#ff').form('submit', {
            url: url,
            onSubmit: function(param){
                var isOk = false;
                isOk = $(this).form('enableValidation').form('validate');
                return isOk;
            },
            success: function (data) {
                layer.msg(JSON.parse(data));
                $('#ff').form('clear');
                $('#w').window('close');
                $("#querybtn").click();
            }
        });
    })

    </script>
</body>

</html>